Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Temperature Measurement gen/ folder from ZAP #3826

Merged

Conversation

vivien-apple
Copy link
Contributor

Problem

#3464 is trying to update all the examples in once. This PR upgrade only the temperature-measurement-app.

In order to produce it, I did a fork with some changes to the ZAP templates (#3780, #3809, #3810 and #3824) and with an extra change to src/app/util/util.cpp (#3825) as I forgot to add a #ifdef at some point.

In order to land, the only requirement from those 5 PRs is #3825.

Then I ran: node src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../app/zap-templates/chip-templates.json -i temperature.zap -o ../../../examples/temperature-measurement-app/esp32/main/gen

temperature.zap is a slightly modified version from the version in #3464 since the version in #3464 kills the commands of the Basic Cluster.

It will require a bit more additional work for the other examples app, notably because the current template for gen_config.h is missing some #define, but in the case of the temperature-measurement-app enough changes has landed inside CHIP that we can start to use the template from ZAP.

Summary of Changes

  • Replace most of the gen/ files from the temperature-measurement-app

@@ -1,4 +1,5 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether it makes sense to put these structs in the same order as Simplicity Studio does... would make these changes a lot easier to review.

I'm taking it on faith, for now, that all these struct definitions are correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably not take it on faith.

If you look at it twice you may noticed that there are some empty structs. For example:

With ZAP templates:

// Struct for Signature
typedef struct _Signature
{
} EmberAfSignature;

With AppBuilder:

// Void typedef for EphemeralData which is empty.
// this will result in all the references to the data being as uint8_t*
typedef uint8_t EphemeralData;

It does work because those are not used. I will open an issue for them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -120,3 +102,19 @@ EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd)
}
return status(wasHandled, true, cmd->mfgSpecific);
}
EmberAfStatus emberAfTemperatureMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this ends up the same as the old code, but with more indirection.... I guess that's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lack of good way to express that with the templates helper. I will open an issue to track that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -71,8 +113,8 @@ void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
* @param value Ver.: always
* @param type Ver.: always
*/
EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(uint8_t endpoint, EmberAfClusterId clusterId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future example apps, we should do the renaming like this in a separate PR (ideally one generated via sed or equivalent). Maybe we should go ahead and do that now-ish, in fact. That will make it clearer which things the ZAP change is really changing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #3846 for that. I don't mind waiting for #3846 to land before this one lands it we want to make the history a little bit cleaner.

@BroderickCarlin
Copy link
Contributor

@vivien-apple can you address the merge conflicts? Should be good to go after that!

@vivien-apple
Copy link
Contributor Author

@vivien-apple can you address the merge conflicts? Should be good to go after that!

Thanks. I'm waiting a little bit, secretly hoping that #3846 lands before ;) If it does not land soon not I will rebase this one.

@vivien-apple vivien-apple force-pushed the ZAP_TemperatureMeasurementUpdate branch from 354b9c6 to 8421ee5 Compare November 20, 2020 23:18
@vivien-apple vivien-apple marked this pull request as ready for review November 20, 2020 23:18
@andy31415 andy31415 merged commit 5379d6b into project-chip:master Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants